import request from "@/utils/request.ts";
import {
    DepartmentResponseData, DoctorResponseData,
    HospitalDetail, HospitalWorkData,
    LoginData, PatientResponseData, ScheduleResponseData,
    UserLoginResponseData,
    WXLoginResponseData
} from "@/api/hospital/type.ts";


enum API{
    HOSPITALDETAIL_URl='/hosp/hospital/',
    //获取某一个医院的科室数据
    HOSPITALDEPARTMENT_URL='/hosp/hospital/department/',
    //获取验证码接口
    // GETUSERCODE_URL = '/sms/send/',
    GETUSERCODE_URL = '/msm/send/',//本地
    //用户登录接口
    UERLOGIN_URL = '/user/login',
    //获取微信扫码登录需要参数
    // WXLOGIN_URL='/user/weixin/getLoginParam'
     WXLOGIN_URL='/ucenter/wx/getLoginParam',   //本地
    //获取某一个医院的某一个科室预约挂号数据
    HOSPITALWORK_URL='/hosp/hospital/auth/getBookingScheduleRule/',
    //获取医院某一个科室某一天相应医生排班的数据
    HOSPITALDOCTOR_URL = '/hosp/hospital/auth/findScheduleList/',
    //获取就诊人信息
    PATIENTS_URL = '/user/patient/auth/findAll',
    //获取医生信息
    SCHEDULE_URL = '/hosp/hospital/getScheduleById/'
}
//获取医院详情的接口
export const reqHospitalDetail = (hoscode:string)=>request.get<any,HospitalDetail>(API.HOSPITALDETAIL_URl+hoscode)

//获取医院科室的接口
export const reqHospitalDepartment = (hoscode:string)=>request.get<any,DepartmentResponseData>(API.HOSPITALDEPARTMENT_URL+hoscode);

//获取验证码接口
export const reqCode=(phone:string)=>request.get(API.GETUSERCODE_URL+phone);

//用户登录接口
export const reqUserLogin = (data:LoginData)=>request.post<any,UserLoginResponseData>(API.UERLOGIN_URL,data);

//获取微信扫码登录生成二维码需要参数接口
export const reqWxLogin = (wxRedirectUri:string)=>request.get<any,WXLoginResponseData>(API.WXLOGIN_URL+`?wxRedirectUri=`+wxRedirectUri);

//获取预约挂号的数据
export const reqHosptalWork=(page:number,limit:number,hoscode:string,depcode:string)=>request.get<any,HospitalWorkData>(API.HOSPITALWORK_URL+`${page}/${limit}/${hoscode}/${depcode}`);

//获取医生排班的数据
export const reqHospitalDoctor = (hoscode:string,depcode:string,workDate:string)=>request.get<any,DoctorResponseData>(API.HOSPITALDOCTOR_URL+`${hoscode}/${depcode}/${workDate}`);
//获取就诊人数据
export const reqPatient = ()=>request.get<any,PatientResponseData>(API.PATIENTS_URL);

export const reqSchedule = (scheduleId:string)=>request.get<any,ScheduleResponseData>(API.SCHEDULE_URL+`${scheduleId}`)
